﻿<%@ WebHandler Language="C#" Class="Area" %>

using System;
using System.Web;
using NS.BLL.Systems;
using NS.Utilities;

public class Area : IHttpHandler
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string result = "";
        if (context.Request["method"] != null)
        {
            string method = context.Request["method"].ToString();
            if (method == "getAreaName")
            {
                string AreaNumber = context.Request["Area"].ToString();
                result = JsonMessager.Success(AreaService.getAreaName(AreaNumber));
            }
            else if (method == "getAreaChildren")
            {
                string AreaNumber = context.Request["Area"].ToString();
                result = JsonMessager.Success(JsonHelper.T2JSON(AreaService.getAreaChildren(AreaNumber)));
            }
            else
            {
                result = JsonMessager.ParamError;
            }
        }
        else
        {
            //参数错误
            result = JsonMessager.ParamError;
        }
        context.Response.Write(result);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}